package com.jhws.business.alert.api;



import javax.annotation.Resource;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jhws.common.base.bo.JsonRespData;
import com.jhws.business.alert.bo.Alarm;
import com.jhws.business.alert.service.AlertService;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;



@Controller
@RequestMapping({"/alertctrl","/alert"})
public class alertAPI{
	
	@Resource
	private AlertService service;
	/**
	 * app报警接口
	 * @param alarm
	 * @return
	 */
	@RequestMapping({"alert.x","alert"})
	@ResponseBody
	@ApiOperation(value = "生成报警信息", httpMethod = "POST", response = JsonRespData.class, notes = "生成报警信息")
	public JsonRespData alert(@ApiParam(required = true, name = "a", value = "报警信息") Alarm a){
		if(StringUtils.isBlank(a.getSipNum())){
			return new JsonRespData("alert", -1, "fail");
		}
		service.saveAlarm(a);
		return new JsonRespData("alert", 1, "success");
	}
}
